Create a VPN profile (vpnconf.create)
Declaration
ok = vpnconf.create(conf)
Parameters
- conf
Table. Dictionary describing the VPN profile to create.
Returns
- ok
Boolean. true on success; false on failure (usually due to missing or invalid parameters).
Description
Quickly create a VPN profile. IKEv2 creation is not supported.
Supported fields of conf
| Field | Type | Meaning |
|---|---|---|
| dispName | string | Display name of the VPN |
| VPNType | string | VPN type. Supports "PPTP", "L2TP", "IPSec" |
| server | string | Server address |
| authorization | string | Account (username) |
| password | string | Password |
| secret | string, optional | Shared secret; can be empty for PPTP |
| encrypLevel | integer, optional | Encryption level; default 1 |
| group | string, optional | Group name; default "" |
| VPNSendAllTraffic | integer, optional | Send all traffic; default 1 |
Example
local success = vpnconf.create{
dispName = 'DemoVPN', -- VPN display name
VPNType = "L2TP", -- VPN type, supports PPTP, L2TP, IPSec (IKEv2 is not supported)
server = 'vpn.example.com', -- Server address
authorization = 'your_account', -- Account
password = 'your_password', -- Password
secret = 'your_shared_secret', -- Shared secret; PPTP can omit
encrypLevel = 1, -- Encryption level (optional; default 1)
group = '', -- Group name (optional; default "")
VPNSendAllTraffic = 1, -- Send all traffic (optional; default 1)
}
if success then
sys.alert('Created successfully')
else
sys.alert('Creation failed. Please verify the configuration is complete and correct.')
end
Note: Uses sys.alert